package com.zhangwei.yueshijia.api;

import rx.Subscriber;

/**
 * Created by zhangwei on 2016/11/22.
 */

public abstract class BaseSubscriber<T> extends Subscriber<T> {


    @Override
    public void onCompleted() {
        onFinish();
    }

    @Override
    public void onError(Throwable e) {
        onFail(ExceptionHandle.handleException(e));
        onFinish();
    }

    @Override
    public void onNext(T bean) {
        onSuccess(bean);
    }

    public abstract void onSuccess(T t);

    public abstract void onFail(ExceptionHandle.ResponeThrowable e);

    public abstract void onFinish();


}
